<?php

namespace app\member\controller;

use app\member\model\Member as MemberModel;

class Member extends Base
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        //
    }

    /**
     * 显示创建资源表单页.
     *
     * @return \think\Response
     */
    public function info($uid)
    {
        if ($this->request->isPost()) {
            $post   = $this->request->post();
            $result = $this->validate($post, 'app\member\validate\Member.edit');
            if (true !== $result) {
                return $this->error($result);
            }

            if (true == MemberModel::edit($post, $post['id'])) {
                return $this->success('修改成功', 'index/index');
            } else {
                return $this->error('修改失败');
            }

        }
        $info = MemberModel::get($uid);
        $this->assign(['info' => $info]);
        return $this->fetch();
    }

    /**
     * 显示编辑资源表单页.
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function edit($id)
    {
        //
    }

}
